package dataService;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MultivaluedMap;

import org.apache.amber.oauth2.ext.dynamicreg.common.OAuthRegistration;
import org.apache.amber.oauth2.ext.dynamicreg.server.request.JSONHttpServletRequestWrapper;

public class OAuthRegistrationWrapper extends JSONHttpServletRequestWrapper{
	MultivaluedMap<String, String> form;
	public OAuthRegistrationWrapper(HttpServletRequest request, MultivaluedMap<String, String> form) {
		super(request);
		this.form=form;
	}
	
	@Override
	public String getContentType()
	{
		return "application/json";
	}

	@Override
	public String getParameter(String name)
	{
		if(name.equals(OAuthRegistration.Request.TYPE)) return OAuthRegistration.Type.PUSH;
		else return form.get(name)==null ? null: form.get(name).get(0).toString();
	}
}
